<?php
class Grocery_Advertisement_model extends grocery_CRUD_Model {

	/**
	 * @author Pwint Phyu Shwe
	 * Advertisement Model for tbl_advertisement and tbl_adv_category tables
	 * This class is constructed for Grocery CRUD queries
	 * Refer detail in each function's comment section below.
	 */
	function get_relation_n_n_unselected_array($field_info, $selected_values)
 
    {
        $selection_primary_key = $this->get_primary_key($field_info->selection_table);
		$userID = (int) $this->session->userdata('userid');
		$this->db->where(advertiserID, $userID );
        $this->db->order_by("{$field_info->selection_table}.{$field_info->title_field_selection_table}");
 
        $results = $this->db->get($field_info->selection_table)->result();
 
 
        $results_array = array();
        foreach($results as $row)
 
        {
            if(!isset($selected_values[$row->{$field_info->primary_key_alias_to_selection_table}]))
                $results_array[$row->{$field_info->primary_key_alias_to_selection_table}] = $row->{$field_info->title_field_selection_table}; 
        }
 
 
        return $results_array;        
    }
	
}
?>